home *** CD-ROM | disk | FTP | other *** search
/ Trusted Irix /B 4.0.4 / Trusted-Irix B-4.0.1.iso / dist / eoe1.idb / usr / include / sys / gr2.h.z / gr2.h
C/C++ Source or Header  |  1992-04-03  |  8KB  |  291 lines

  1. #ifndef __SYS_GR2_DEV_H__
  2. #define __SYS_GR2_DEV_H__
  3.  
  4. /*
  5.  * $Revision: 1.50 $
  6.  */
  7. #include "gfx.h"
  8. #include "rrm.h"
  9.  
  10. #ifdef IP17
  11. #define GFX_NAME_GR2        "GR2MP"    /* Unique name for GR2 type boards */
  12. #else
  13. #define GFX_NAME_GR2        "GR2"    /* Unique name for GR2 type boards */
  14. #endif
  15.  
  16. struct gr2_info {
  17.     struct gfx_info gfx_info;     /* device independent information */
  18.  
  19.     unsigned char BoardType;    /* 0 for a GR2, 1 for HI1 */
  20.     unsigned char Bitplanes;     /* 8 or 24 */
  21.      unsigned char Auxplanes;    /* 2 or 4 */
  22.     unsigned char Wids;        /* 2 or 4 */
  23.     unsigned char Zbuffer;        /* true if zbuffer option installed */
  24.     unsigned char MonitorType;    /* monitor id & setmon state */
  25.     unsigned char GfxBoardRev;
  26.     unsigned char PICRev;
  27.     unsigned char HQ2Rev;
  28.     unsigned char GE7Rev;
  29.     unsigned char RE3Rev;
  30.     unsigned char VC1Rev;
  31.     unsigned char VidBckEndRev; 
  32.     unsigned char Xabnormalexit;    /* X killed without closing file
  33.                        descriptor. */
  34.     unsigned char GEs;        /* 1 or 4 */
  35. };
  36.  
  37. /*
  38.  * XXX If change Gr2PixelDma() or any of these defines, check the others!
  39.  */
  40. #define DMAMAXXLEN     1280    /* Max x length for pixel DMA */
  41. #define DMAMAXYLEN     1024    /* Max y length for pixel DMA */
  42.  
  43. #define    GR2_GFXPG_VADDR    0x1000    /* Used in gl - virtual graphics address */
  44.  
  45. #ifdef _KERNEL
  46.  
  47. #define GR2_BASE_PHYS    0x1F000000    /* private bus GR2 board family base 
  48.                      * physical addr */
  49.  
  50. #define GR2_3WAY_SIZE    0x2000
  51. #define GR2_GFX_SIZE    0x6D000
  52. #define GR2_MAP_SIZE    (GR2_GFX_SIZE + GR2_3WAY_SIZE)
  53.                     /* size of region to map into graphics
  54.                      * process's address space */
  55.  
  56. /* GR2 variants; -1 means probe failed */
  57. #define GR2_TYPE_NOT_THERE -1        /* probe failed */
  58. #define GR2_TYPE_GR2    0        /* Express  GR2 */
  59. #define GR2_TYPE_HI1    1        
  60.  
  61. /*
  62.  * Change the timing table as screen x coord of cursor crosses this x value.
  63.  * This value must be < 1024, since for high res. 1024+250bp = 1280, 
  64.  * which is the max range of CUR_XL.
  65.  * Be aware when changing this value which side of the "border" the cursor
  66.  * will be on when the xserver starts up. Set the GR2_VID_EP for the correct
  67.  *      timing table in the VC1 initialization, accordingly.
  68.  */
  69. #define GR2_CURS_CHNGE_TIMING 32 
  70.  
  71. /*
  72.  * XXX If change Gr2PixelDma() or any of these defines, check the others!
  73.  */
  74. #define PGSPERSHOT    32    /* Number pages map/lock at a shot*/
  75. #define MAXPERSHOT    (NBPC * PGSPERSHOT) /* Max bytes map/lock at a shot */
  76.  
  77. #define CXDMAPAGES    20
  78.  
  79. struct gr2_data {
  80.     struct gfx_data    gfx_data;    /* Common gfx driver above */
  81.  
  82.     struct gr2_info *info;    /* gr2 inventory */
  83.  
  84.     struct gr2_hw    *base;        /* K1 seg board base address */
  85.     unsigned int    attaches;
  86.     int         cursor_x;    /* x passed by Xserver*/
  87.     int         cursor_y;    /* y passed by Xserver*/
  88.     int         cursor_xhot;    /* x hot position */
  89.     int         cursor_yhot;    /* y hot position  */
  90.     int         mon_xoffset;    /* mon. dependent horizontal offset*/
  91.     int         mon_yoffset;    /* mon. dependent vertical offset*/
  92.     void         *Retrace ;
  93.     sema_t        dmalock;
  94.     void        *dmadap;    /* DMA descriptor array for pixels */
  95.     void        *cxdmadap;    /* DMA descriptor array for context
  96.                        switching */
  97.                     /* The owner of the data buffer */
  98.     struct rrm_rnode    *scratchrn;
  99.     struct rrm_rnode    *nurbsrn;
  100.     struct rrm_rnode    *spotlightrn;
  101.     struct rrm_rnode    *volumern;
  102.  
  103.     unsigned long loadedmodes[32];
  104. #ifdef IP17
  105.     unsigned void   *adapter_base;    /* kernel address of base address of adapter board */
  106.     int        adapter_slot;    /* MP slot id of adapter (only on MP bus systems)*/
  107.     int        gio_slot;    /* MP slot id of GIO (only on MP bus systems)*/
  108. #endif
  109. };
  110.  
  111. /*
  112.  * device dependent rendering node
  113.  */
  114. struct gr2_rnode {
  115.     /* Context switch stuffs */
  116.     long user_finish;
  117.     long pcxtype;    /* New, GE, Host, Dump */
  118.     unsigned long pcxsize;    /* Small, Light */
  119.     unsigned long newpcxsize;
  120.     struct RRM_ValidateClip validateclip;
  121.     long pcxdatatype;     /*
  122.                    bit 0 - DATA_NURBS
  123.                    bit 1 - DATA_SPOTLIGHT
  124.                    bit 2 - DATA_VOLUME
  125.                    bit 3 - DATA_TEXTURE
  126.                    bit 4 - DATA_VOLUME8K
  127.                    bit 5 - DATA_VOLUME16K
  128.                    bit 6 - DATA_SCRATCH
  129.                 */
  130.                 /* all kinds of data buffer */
  131.     void        *scratchp;
  132.     unsigned long    scratch_datasize;
  133.     unsigned long    scratch_bufsize;
  134.  
  135.     void        *nurbsp;
  136.     unsigned long    nurbs_size;
  137.  
  138.     void        *spotlightp;
  139.     unsigned long    spotlight_size;
  140.  
  141.     void        *volumep;
  142.     unsigned long    volume_size;
  143.  
  144.     /* XXX add VOLUME8K, VOLUME16K later */
  145.  
  146.     /* Retrace stuffs */
  147.         unsigned long swapinterval; /* Min. retraces between swapbuffers */
  148.         unsigned long nextswap; /* Retrace count value to swapbuffers at */
  149.  
  150.         struct gr2_cyclemap *cyclemap; /* malloced array of 16 when used */
  151.         unsigned long cyclemap_curmap;
  152.         unsigned long cyclemap_nexttime;
  153.  
  154.         struct gr2_blink *blink;       /* malloced array of 20 when used */
  155.  
  156.         struct rrm_rnode *nextintervalrnp;
  157. #ifdef IP17
  158.     /* MG1 board control registers */
  159.     unsigned long mg1_control1;
  160.     unsigned long mg1_control2;
  161.     /* IP17 3way registers */
  162.     unsigned long ip17p3way_cntcmdreg; /* only 16 bits are valid */
  163.     unsigned long ip17p3way_ABCDregs[4];
  164. #endif
  165. };
  166.  
  167.  
  168. #endif /* _KERNEL */
  169.  
  170. /*
  171.  *   GR2 specific (gf_Private) Ioctls
  172.  */
  173. #define GR2_BASE                15000
  174. #define GR2_SETCURSOR_HOTSPOT   (GR2_BASE+3)
  175. #define GR2_SETMONITOR         (GR2_BASE+5)
  176. #define GR2_SETGAMMARAMP    (GR2_BASE+6)
  177. #define GR2_GETMONITOR        (GR2_BASE+8)
  178. #define GR2_PIXELDMA            (GR2_BASE+10)
  179. #define GR2_CHANGECXSIZE    (GR2_BASE+11)
  180. #define GR2_TEXTUREDMA        (GR2_BASE+12)
  181. #define GR2_ACCUMULATE        (GR2_BASE+13)
  182. #define GR2_ACRETURN        (GR2_BASE+14)
  183. #define GR2_ALLOCCXDATA        (GR2_BASE+15)
  184. #define GR2_SETDISPLAYMODE    (GR2_BASE+16)
  185.  
  186. /*
  187.  *   GR2 Ioctl args
  188.  */
  189.  
  190. struct gr2_colorentry {
  191.     unsigned short index;
  192.     unsigned char red;
  193.     unsigned char green;
  194.     unsigned char blue;
  195.     unsigned char junk;     /*XXX What is this?*/
  196. };
  197.  
  198. struct gr2_setcolor_args {
  199.     short numberofcells;
  200.     struct gr2_colorentry colors[1];    
  201. };
  202.  
  203. struct gr2_setdisplaymode_args {
  204.        long int wid;
  205.     unsigned long int displaymode;
  206. };
  207.  
  208. struct gr2_blankscreen_args {
  209.        int blank;        /* 0 on, 1 off, 2 query */
  210. };
  211.  
  212. /* Flags for graphics DMA */
  213. #define GR2_WRITE       0x01            /* DMA direction: host to gfx */
  214. #define GR2_STRIDE      0x02            /* Stride DMA */
  215. #define GR2_TTOB        0x04            /* Pixels dma'ed from top to bottom */
  216. #define GR2_RTOL        0x08            /* Pixels dma'ed from right to left */
  217. #define GR2_ZOOM        0x10            /* Zoomed pixels */
  218.  
  219. #define MAXDMADA        200             /* The maximum DMA descriptor arrays 
  220.                        for simulation */
  221. struct gr2_pixeldma_args {
  222.     long token;            /* Token to send down pipe */
  223.     long x;                /* Rectangular coordinate in pixels */
  224.     long xlen;
  225.     long y;
  226.     long ylen;
  227.     unsigned short flags;        /* Bit flags defined below */
  228.     long pmstride;            /* Number of 32-bit CPU words per
  229.                        scanline */
  230.     long yzoom;            /* Zoom factor in Y */
  231.     long nbytes;            /* Total bytes of DMA,
  232.                        stride = pmstride * ylen * 4;
  233.                        non-stride = wlen * ylen * 4
  234.                      */
  235.     long wlen;            /* # of dma words (in words) */
  236.     char *buf;            /* Data buffer */
  237. };
  238.  
  239. struct gr2_setcursor_hotspot_args{
  240.     unsigned short xhot;    /* X cursor hotspot */
  241.     unsigned short yhot;    /* Y cursor hotspot */
  242. };
  243.  
  244. struct gr2_acbufdma_args {
  245.     long    token;            /* GL token */
  246.     long    x;            /* accumulation buffer area */
  247.     long    xlen;    
  248.     long    y;
  249.     long    ylen;
  250.     long    scale;
  251.     long    *buf;
  252. };
  253.  
  254. struct gr2_alloccxdata_args {
  255.     long datatype;
  256. };
  257.  
  258. struct gr2_getcmap_args {
  259.         unsigned int start;
  260.         unsigned int size;
  261.         unsigned char *buffer;
  262. };
  263. struct gr2_getoverlaycmap_args {
  264.         unsigned int size;
  265.         unsigned char *buffer;
  266. };
  267.  
  268. struct gr2_setgammaramp_args {
  269.         unsigned char red[256];
  270.         unsigned char green[256];
  271.         unsigned char blue[256];
  272. };
  273.  
  274. /*  Monitor types - for setmonitor  */
  275. /* IMPT: Xserver assumes that interlaced monitors have the low bit set to 1.*/
  276. #define    GR2_HZ60    0 
  277. #define    GR2_NTSC    1 /* Interlaced */    
  278. #define    GR2_STR_RECT    2    
  279. #define    GR2_PAL        3 /* Interlaced */    
  280. #define    GR2_HZ72    4
  281.  
  282. /* Flags for genlock */ 
  283. #define GR2_GENLOCK_IN        0x01
  284.  
  285. struct gr2_monitor_args {
  286.     unsigned long monitortype;
  287.     unsigned char flag;
  288. };
  289.  
  290. #endif /* __SYS_GR2_DEV_H__ */
  291.